package com.ccsoft.dynamicproxy;

import com.ccsoft.service.Sell;
import com.ccsoft.service.Vendor;

import java.lang.reflect.Proxy;

/**
 * 测试动态代理
 */
public class DynamicProxyTest {
    public static void main(String[] args) {
        DynamicProxy proxy = new DynamicProxy(new Vendor());
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles","true");
        Sell sell = (Sell)(Proxy.newProxyInstance(Sell.class.getClassLoader(),new Class[]{Sell.class},proxy));
        sell.sell();
        sell.add();
    }
}
